package roboSoccer;

/**
 * Abstract class to base player behaviors off of. Player behaviors control an
 * individual robot and can be very complicated or very simple. Defines the
 * standard methods that all player behaviors must have. As a superclass, it
 * also stores the host robot player and the name of the behavior.
 * 
 * @author Ben Hopkins
 * 
 */
public abstract class PlayerBehavior {

	/**
	 * Stores the name of this player behavior. If the behavior was given
	 * arguments, they should be represented in the name, because the name is
	 * checked to change to a different behavior (so if the name is not
	 * different any new arguments will not be implemented).
	 */
	public String name;
	
	/**
	 * A string that may describe the current action of this Player Behavior.
	 */
	public String message;

	/**
	 * The robot that this behavior is controlling.
	 */
	public RoboPlayer host;

	/**
	 * The standard constructor passes behavior's host robot and the behavior's
	 * name.
	 * 
	 * @param host
	 *            The robot exhibiting this behavior.
	 * @param name
	 *            Name of this behavior.
	 */
	public PlayerBehavior(RoboPlayer host, String name) {
		this.host = host;
		this.name = name;
		message = "";
	}

	/**
	 * Is called when the behavior should send commands to the robot.
	 * 
	 * @param game
	 *            The data for the current GameState.
	 * @param controller
	 *            The controller that should be used to command the robot.
	 */
	public abstract void update(GameState game);

	/**
	 * Unused? Perhaps could be useful for self-guidance in the future.
	 * 
	 * @param game
	 *            GameState.
	 */
	public abstract boolean leaveState(GameState game);

	/**
	 * Returns the name of the behavior.
	 */
	public String toString() {
		return name;
	}
}
